package api

import (
	"fmt"
	"net/http"
	"go-http-server/app/httpserver/api/server"
)

var urlPrefix = "/"

var ApiCollector = map[string]func(http.ResponseWriter, *http.Request){}

func init() {
	ApiCollector[urlPrefix] = Index

	// 服务模块的路由收集
	for path, handle := range server.FuncList() {
		ApiCollector[urlPrefix + path] = handle
	}
}

func Index(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "您正在访问API接口")
}
